<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;charset=UTF-8" language="java"  pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="spring" uri="/WEB-INF/lib/spring.tld"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f" %>
<%@ taglib prefix="z" uri="/WEB-INF/lib/zerdoor.tld"%>
<c:set value="${pageContext.request.contextPath}" var="path" scope="page"/>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title><spring:message code='chatMain.title.msg' /></title>
    <link href="${path}/style/acg/css/style.css" rel="stylesheet" type="text/css" />

    <script src="${path}/js/jquery.min.js" type="text/javascript"></script>
    <%--<script type="text/javascript" src="${path}/style/acg/js/common.js"></script>--%>
    <!-- 文件上传JS -->
    <script type="text/javascript" src="${path}/js/ajaxfileupload.js"></script>
		<script type="text/javascript">


            $(function(){


                $("#item_info").val("${itemId}");

                f_findContract($("#item_info").val());

            });

            //加载任务房间
            function f_loadChatHouse(contract_id){

                //加载聊天房间
                $("#houseDiv").load("${path}/chatManage/chatHouse.html?contract_id="+contract_id);
                //加载阶段信息
                $("#stageDiv").load("${path}/itemStage/findStageByContractId.html?userType=${userType}&contractId="+contract_id);

                $("#taskHouseName").html($("#item_contract").find("option:selected").text());

            }



            function f_findContract(item_id){



                $.post("${path}/chatManage/findContractByItemId.html",{item_id:item_id,type:${userType}},function(result){

                    var html = "";

                    for(var i in result){
                        var bean = result[i];

                        html += "<option value='"+bean.contract_id+"'>"+bean.title+"</option>";

                    }

                    $("#item_contract").html(html);

                    f_loadChatHouse($("#item_contract").val());
                });
            }


            //下载文件
            function f_download(url){
                url = encodeURIComponent(encodeURIComponent(url))
                window.location.href = "${path}/fileDownload/download_file.html?res_url="+url;

            }


            $(window).resize(function() {
                UpdateSize();
            });
            function closeWin(){
                $("#openwin").hide();
            }
            function openWin(){

                $("#openmain").load("${path}/itemAppraise/appraise.html?contractId="+$("#item_contract").val()+"&type=${userType}",function(){
                    $("#openwin").show();
                    UpdateSize();
                });


            }
            function UpdateSize(){
                var _width= parseFloat($(document).width());
                var _height=parseFloat($(window).height());
                if(_width<900){ _width=900;}
                if(_height<600){ _height=600;}
                var open_height=parseFloat($("#openbox").height());
                if(_height<open_height){_height=open_height;}
                var open_mt=(_height-open_height)/2;

                $("#openbox").css({"margin-top":open_mt+"px"});
                $("#openwin").css({"width":_width+"px","height":_height+"px"});
            }
			     
		</script>

	</head>

	<body >
    <div class="header">
        <jsp:include page="../public/header.jsp">
            <jsp:param    name="home"    value="dddd"    />
        </jsp:include>
    </div>

    <div id="container">
        <div class="wrapper">
            <div class="member_mroom_left">
                <div class="member_mroom_box">
                    <div class="member_mroom_tabs clearfix">
                        <ul class="clearfix">
                            <li id="taskHouseName"></li>
                            <!--<li class="downli"></li>-->
                            <li class="sel">
                                <select id="item_info" name="" onchange="f_findContract(this.value)">
                                    <c:forEach items="${inItemList}" var="inItem">
                                        <option value="${inItem.item_id}">${inItem.title}</option>

                                    </c:forEach>
                                </select>
                            </li>
                            <li class="sel">
                                <select id="item_contract" onchange="f_loadChatHouse(this.value)" name="">

                                </select>
                            </li>
                        </ul>
                        <%--<div class="more"><a href="">查看聊天记录</a></div>--%>
                    </div>
                </div>
                <div id="houseDiv" >

                </div>
            </div>
            <div class="member_mroom_right" id="stageDiv">

            </div>
            <div class="clr"></div>
        </div>

        <div id="openwin" class="openwin" style="width: 1382px; height: 600px;display: none">
            <div id="openbox" class="openbox" style="margin-top: 10.5px;">
                <h1><spring:message code='chatMain.message.msg1' /><span id="closeopen" class="closeopen" onclick="closeWin()">×</span></h1>
                <div id="openmain" class="openmain">

                </div>
            </div>
        </div>
    </div>



    <div id="footer">
        <!--content-->
        <jsp:include page="../public/footer.jsp"></jsp:include>
    </div>
	</body>
</html>
